import { Suspense } from 'react'
import { Spin } from 'antd'

// ****
export const lazyLoad = (
  Component: React.LazyExoticComponent<() => JSX.Element> | React.FC // 路由组件
) => {
  const style = { display: 'flex', alignItems: 'center', justifyContent: 'center', height: '100%' }
  return (
    <Suspense fallback={<Spin size='large' style={style} />}>
      <Component />
    </Suspense>
  )
}
